package com.shuqi.model.parse.parser;

import java.util.ArrayList;
import java.util.List;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import com.shuqi.model.bean.CheckBookUpdateInfo;
import com.shuqi.model.bean.CheckPushMessageInfo;
import com.shuqi.model.parse.HandlerBase;

public class PushMessageParser extends HandlerBase{

    private List<CheckPushMessageInfo> list;

    @Override
    public Object getParsedData() {
        return list;
    }

    @Override
    public void startDocument() throws SAXException {
        super.startDocument();
    }

    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes)
            throws SAXException {
        if ("Pushs".equals(localName)) {
                list = new ArrayList<CheckPushMessageInfo>();
            }
            if ("Push".equals(localName)) {
                CheckPushMessageInfo info = new CheckPushMessageInfo();
                    info.setBookId(isNull(attributes, "pushType"));
                    info.setBookName(isNull(attributes, "title"));
                    info.setUpdateTime(isNull(attributes, "description"));
                    info.setSourceId(isNull(attributes, "pushId"));
                    info.setMaxOid(isNull(attributes, "content"));
                    list.add(info);
                }

   }
}

